package by.uvaga.wind;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;

public class GraphicsActivity extends Activity {
    /** Called when the activity is first created. */
    
    private PaintView paintView = null;
    
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        //GraphicView myview = new GraphicView(this);
        PaintView paintview = new PaintView(this);
        setContentView(paintview);
        paintView = paintview;
    }

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// TODO Auto-generated method stub
		MenuInflater inflater = getMenuInflater();
		inflater.inflate(R.menu.icon_menu, menu);
		return true;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		// TODO Auto-generated method stub
		switch(item.getItemId()) {
			
		case R.id.back:
			back();
			return true;
		case R.id.options:
			showOptions();
			return true;
		case R.id.cleanall:
			cleanall();
			return true;
		case R.id.exit:
			exit();
			return true;
		default:
			return super.onOptionsItemSelected(item);
		}
		 
	}

	private void showOptions() {
		// TODO Auto-generated method stub
		Intent intent = new Intent(getApplicationContext(), OptionsActivity.class);
		intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
		startActivity(intent);
		Log.v("GraphicsActivity", "Activity OptionsActivity Started........");
	}

	private void exit() {
		// TODO Auto-generated method stub
		finish();
	}

	private void cleanall() {
		// TODO Auto-generated method stub
		paintView.cleanall();
	}

	private void back() {
		paintView.back();
	}
    
    
}